import 'package:flutter/material.dart';
import 'package:flutter_boost/boost_navigator.dart';

class FlutterPushPage extends StatelessWidget {
  final String uniqueId;
  final Map arguments;

  const FlutterPushPage({this.uniqueId, this.arguments});

  @override
  Widget build(BuildContext context) {
    bool isPush;
    String title;
    bool navigationBarHidden;
    if (arguments != null) {
      isPush = arguments.putIfAbsent('is_push', () => true);
      title =
          arguments.putIfAbsent('title', () => 'this is no push flutter page');
      navigationBarHidden =
          arguments.putIfAbsent('navigationBarHidden', () => false);
    }
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: navigationBarHidden == true
            ? AppBar(
                title: Text('flutter page'),
              )
            : Container(),
        body: Container(
          child: Column(children: [
            Text(title),
            isPush
                ? TextButton(
                    onPressed: () => BoostNavigator.of()
                        .push('ir', arguments: {'animated': true}),
                    child: Text('Push to Native'),
                  )
                : Container(height: 0),
          ]),
        ),
      ),
    );
  }
}
